
const state = {//数据
  loading: false,
  onMockjs: false,
  latestVersion: '',
  data:{}
}

const getters = {//获取数据
  /*getLoadingStatus: function (state) {
    return state.loading
  }*/
  getLoadingStatus: state => state.loading,//es6箭头函数写法
  getOnMockjs: state => state.onMockjs,
  getLatestVersion: state => state.latestVersion,
  getData: state => state.data
}

const mutations = {//对本地无需ajax的更改，使用mutations
  updateLoadingStatus (state, changed) {
    state.loading = changed
  },
  updateOnMockjs (state, changed) {
    state.onMockjs = changed
  },
  updateLatestVersion (state, changed) {
    state.latestVersion = changed
  },
  updateData (state, changed) {
    state.data = changed
  }
}

const actions = {//action好处适合异步操作，action先执与后端交互，mutations后执行
}

export default {
  state,
  getters,
  mutations,
  actions
}
